package gunfire.potions;

import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.PowerTip;
import com.megacrit.cardcrawl.localization.PotionStrings;
import com.megacrit.cardcrawl.potions.AbstractPotion;
import gunfire.GunfireMod;
import gunfire.relics.SoulOfTaizi;

public class ShieldPotion extends AbstractPotion {
    public static final String POTION_ID = GunfireMod.makeID("ShieldPotion");
    private static final PotionStrings potionStrings = CardCrawlGame.languagePack.getPotionString(POTION_ID);
    public static final String NAME = potionStrings.NAME;
    public static final String[] DESCRIPTIONS = potionStrings.DESCRIPTIONS;

    public ShieldPotion() {
        super(potionStrings.NAME, POTION_ID, PotionRarity.COMMON, PotionSize.BOTTLE, PotionColor.BLUE);
        this.isThrown = false;
        this.targetRequired = true;
    }

    public int getPotency(int ascensionLevel) {
        return 18;
    }

    public void initializeData() {
        this.potency = this.getPotency();
        this.description = potionStrings.DESCRIPTIONS[0] + this.potency + potionStrings.DESCRIPTIONS[1];
        this.tips.clear();
        this.tips.add(new PowerTip(this.name, this.description));
    }

    public void use(AbstractCreature target) {
        AbstractPlayer p = AbstractDungeon.player;
        this.addToBot(new GainBlockAction(p, p, this.potency));
        this.addToBot(new GainBlockAction(target, p, this.potency));
        if(p.hasPower("gunfire:GenerosityPower")){
            this.addToBot(new GainBlockAction(p, p, this.potency));
        }
        if(p.hasRelic("gunfire:SoulOfTaizi")){
            SoulOfTaizi r = (SoulOfTaizi) p.getRelic("gunfire:SoulOfTaizi");
            r.flash();
            r.progress3 += this.potency;
            r.judgeEvolve();
        }
    }

    public AbstractPotion makeCopy() {
        return new ShieldPotion();
    }

}
